#include "systemlog.h"
#include "freyacommon.h"

SystemLog::SystemLog() :
    AbstractStruct(AbstractStruct::SystemLog)
{
    GUID = QUuid::createUuid().toString();
    Date = QDateTime::currentDateTime();
    LogString.clear();
    FreyaSerializeData.clear();
}

QVariant SystemLog::ToTemplate(QVariantMap &varMap)
{
    varMap.insert("GUID", GUID);
    varMap.insert("Date", FreyaCommon::DateTimeToString(Date));
    varMap.insert("LogString", LogString);
    varMap.insert("FreyaSerializeData", FreyaSerializeData);
    return varMap;
}

void SystemLog::FromTemplate(const QVariant &variant)
{
    GUID = variant.toMap().value("GUID").toString();
    Date = FreyaCommon::StringToDateTime(variant.toMap().value("Date").toString());
    LogString = variant.toMap().value("LogString").toString();
    FreyaSerializeData = variant.toMap().value("FreyaSerializeData").toString();
}
